﻿namespace FSharpChess
open System.Threading
module Parallel =
    let core_type = if System.Environment.ProcessorCount<=2 then 0 else 1
    let limt = ref false
    let set_lim() = 
        if not !limt then
            limt:=true
            ThreadPool.SetMaxThreads(2,2)|>ignore
    let cpu_async f a =
        a
        |> Array.map(fun x -> async{return (f x)})
        |> Async.Parallel
        |> Async.RunSynchronously
